import pandas as pd
from scipy import stats

file_path = 'double_T.xlsx'
sheet_name = 'Sheet1'
df = pd.read_excel(file_path, sheet_name=sheet_name)

if 'A' not in df.columns or 'B' not in df.columns:
    raise ValueError("Excel文件中必须包含A列和B列")

data_A = df['A']
data_B = df['B']

t_stat, p_value = stats.ttest_ind(data_A, data_B)

print(f"T统计量: {t_stat}")
print(f"P值: {p_value}")

alpha = 0.05
if p_value < alpha:
    print("两个样本的均值存在显著差异")
else:
    print("两个样本的均值不存在显著差异")

